#pragma once
#include <Windows.h>
#include "../Global References/timer.h"
#include "../Global References/Globals.h"
#include "Graphics.h"
#include "Input.h"
#include "DrawlistHandler.h"
#include "GameHandler.h"
#include "SoundEngine.h"

LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

/*************************************************************************************************************************************************************/
/* This is the Gauntlet Engine that is responsible for handling all aspects of the program
/* It will contain the following modules: GameHandling, DrawlistHandler, Graphics, Input, and Sound
/* The reason for Engine being a singleton is to allow modules within it to easily communicate to other modules
/*
/* -Michael Alstad
/*************************************************************************************************************************************************************/


class Engine
{
private:

	HWND		m_hWnd;
	MSG			m_uMsg;
	HINSTANCE	m_hInstance, m_hPrevInstance;
	LPSTR		m_lpCmdLine;
	int			m_nCmdShow;
	HWND OpenWindow(const char* cszWindowName, int nCmdShow);

	Engine();

public:

	bool toQuit;
	Graphics		graphics;
	SoundEngine		sound;
	DInput			input;
	DrawlistHandler dlHandler;
	GameHandler		game;
	int				m_gameState;

	stopWatch		m_throttle;	//Throttle Code

	inline static Engine* Ins() { static Engine e; return &e; }
	void Init(HINSTANCE hInstance,							// to be called once at the beginning of the program
			  HINSTANCE hPrevInstance, 
			  LPSTR lpCmdLine, 
			  int nCmdShow);		
	void Work();											// to be called once per frame
	void Release();											// to be called at the end
	

	WPARAM getWParam() { return m_uMsg.wParam; }
};

